package com.ruoyi.web.enums;

import java.util.HashMap;
import java.util.Map;

public enum InsectWarningTypeEnum {

    //1 始见预警 2 日高峰 3 月高峰
    FIRST(1, "始见预警"),
    DAY(2,"日高峰预警"),
    MONTH(3,"月高峰预警"),
    ;

    private final int code;
    private final String describe;

    InsectWarningTypeEnum(int code, String describe){
        this.code = code;
        this.describe = describe;
    }

    public Integer getValue() {
        return this.code;
    }

    public String getDescription() {
        return this.describe;
    }

    //根据code查询枚举
    public static InsectWarningTypeEnum getByCode(int code){
        InsectWarningTypeEnum[] enums = InsectWarningTypeEnum.values();
        for( InsectWarningTypeEnum codeEnum : enums){
            if(codeEnum.getValue() == code){
                return codeEnum;
            }
        }

        return null;
    }

    static Map<String,String> map = new HashMap<>();

    static {
        for (InsectWarningTypeEnum value : InsectWarningTypeEnum.values()) {
            map.put(value.name(),value.getDescription());
        }
    }

    /**
     * @desc  得到枚举映射的MAP
     * @author fwx 2023/10/17 16:37
     **/
    public static Map<String,String> getDescMap(){
        return map;
    }

}
